Sainz became a free agent at the start of February when Ferrari announced that it had recruited Lewis Hamilton to partner Charles Leclerc from 2025.
Sainz bided his time to assess his options, with several interested parties, including the Audi-owned Sauber project, Alpine, and Williams.
Williams Team Principal James Vowles identified Sainz as its primary candidate to join incumbent Alex Albon and on Monday an agreement was reached.
Sainz has signed for 2025 and 2026, with options for 2027 and beyond.
“It is no secret that this year’s driver market has been exceptionally complex for various reasons and that it has taken me some time to announce my decision,” Sainz said.
“However, I am fully confident that Williams is the right place for me to continue my F1 journey and I am extremely proud of joining such a historic and successful team, where many of my childhood heroes drove in the past and made their mark on our sport.
“The ultimate goal of bringing Williams back to where it belongs, at the front of the grid, is a challenge that I embrace with excitement and positivity.
“I am convinced that this team has all the right ingredients to make history again and starting on January 1 I will give my absolute best to drive Williams forward alongside every single member of the team.”
Vowles hailed the signing of Sainz, believing it to be a signal of the Spaniard’s faith in Williams’ long-term plan.
“Carlos joining Williams is a strong statement of intent from both parties,” Vowles said.
“Carlos has demonstrated time and again that he is one of the most talented drivers on the grid, with race-winning pedigree, and this underlines the upwards trajectory we are on.
“Carlos brings not just experience and performance, but also a fierce drive to extract every millisecond out of the team and car; the fit is perfect.
“In Alex and Carlos we will have one of the most formidable driver line-ups on the grid and with huge experience to guide us into the new regulations in 2026.
“Their belief in this organisation’s mission demonstrates the magnitude of the work going on behind the scenes.
“People should be in no doubt about our ambition and momentum as we continue our journey back to competitiveness – we are here, we are serious and with Dorilton’s backing we are investing in what it takes to return to the front of the grid.”